﻿using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics;

namespace AspNetCoreMvc
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //创建主机建造者对象
            WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
            webApplicationBuilder.Services.AddControllersWithViews();
            //webApplicationBuilder.Services.AddAuthorization();
            //构建主机
            WebApplication webApplication = webApplicationBuilder.Build();
            webApplication.UseStaticFiles();

            webApplication.MapControllerRoute(name: "default", pattern: "{controller=Product}/{action=Index}/{Id?}", defaults:new { });
            // 区域路由  
            webApplication.MapAreaControllerRoute(
                name: "MyArea_default",
                areaName: "MyArea",
                pattern: "MyArea/{controller=Home}/{action=Index}/{id?}");
            //运行项目主机
            webApplication.Run();
        }
    }
}
